package it.poste.il.compensatore.service.impl;

import it.poste.il.compensatore.dao.MessageDao;
import it.poste.il.compensatore.entities.Message;
import it.poste.il.compensatore.service.MessageService;

import java.util.List;

import org.springframework.stereotype.Service;

/**
 * Implementation of MessageService.
 */
@Service("messageService")
public class MessageServiceImpl implements MessageService {

	MessageDao messageDao;

	/**
	 * Take the message dao.
	 * @return MessageDao The message dao.
	 */
	public MessageDao getMessageDao() {
		return messageDao;
	}

	/**
	 * Set the message dao.
	 * @param messageDao The message dao to set.
	 * @return void
	 */
	public void setMessageDao(MessageDao messageDao) {
		this.messageDao = messageDao;
	}

	/**
	 * Select the id operation of message.
	 * @param msg The message.
	 * @return int The id operation of message.
	 */
	public int selectOperationId(Message msg) {
		return messageDao.selectOperationId(msg);
	}

	/**
	 * Select the id status of message.
	 * @param msg The message.
	 * @return int The id status of message.
	 */
	public int selectStatusId(Message msg) {
		return messageDao.selectStatusId(msg);
	}

	/**
	 * The list of all messages by a type.
	 * @param type The type of message.
	 * @return List The list of Messages.
	 */
	public List<Message> loadListByType(int type) {
		return messageDao.loadListByType(type);
	}

	/**
	 * Method that retrieve the messageby id.
	 * @param id Id to identify the message.
	 * @return Message The entity Message.
	 */
	public Message retrieveByID(Long id) {
		return messageDao.loadById(id);
	}

	/**
	 * The list of all messages.
	 * @return List The list of Messages.
	 */
	public List<Message> retrieveAll() {
		return messageDao.loadAll();
	}

	/**
	 * Method that save the message.
	 * @param message Message to save.
	 * @return Message The Message saved.
	 */
	public Message save(Message message) {
		return messageDao.save(message);
	}

	/**
	 * Update the message.
	 * @param message Message to update.
	 * @return void
	 */
	public void update(Message message) {
		messageDao.update(message);
	}

	/**
	 * Delete the message.
	 * @param message Message to delete.
	 * @return void
	 */
	public void delete(Message message) {
		messageDao.delete(message);
	}
	
}
